Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swarm/api: support mounting manifests via FUSE #3690

Merged
merged 1 commit into from
Mar 23, 2017
Merged

swarm/api: support mounting manifests via FUSE #3690

merged 1 commit into from
Mar 23, 2017

Conversation

jmozah
Copy link
Contributor

@jmozah jmozah commented Feb 19, 2017

This PR adds mounting swarm hash/ensname as a fuse fie system.
It adds new commands to swarm cmdline

  • swarmfs.mount (manifest-hash/ensname, mountpoint)
  • swarmfs.listmounts ()
  • swarmfs.unmount (mountpoint)

Tested in linux and osx.

  • Requires fuse to be installed for this to work.
  • Mounts the FS as read only for now

@mention-bot
Copy link

@jmozah, thanks for your PR! By analyzing the history of the files in this pull request, we identified @zsfelfoldi, @fjl and @karalabe to be potential reviewers.

@jmozah
Copy link
Contributor Author

jmozah commented Feb 19, 2017

This also supports random seek on a big file making full use of the lazyreader in swarm.
Need to add "force unmount/ external unmount" while quitting swarm...

@zelig zelig changed the title rpc;swarm;cmd/swarm;swarm/api : Fuse support for swarm FUSE read-only support for swarm Feb 23, 2017
@zelig
Copy link
Contributor

zelig commented Feb 23, 2017

reviewing this now

@GitCop
Copy link

GitCop commented Feb 24, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: c100b2f8b3aa6cb7ef4814edab286d525b0d7f97
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Feb 24, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: c100b2f8b3aa6cb7ef4814edab286d525b0d7f97

  • Commits must be prefixed with the package(s) they modify

  • Commit: 46fd61e3619cf13848503ed124479bc2b856d4b5

  • Commits must be prefixed with the package(s) they modify

  • Commit: 82d421d7fdf4b5cc9c0e574c7b31339b03cc8ae6

  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

1 similar comment
@GitCop
Copy link

GitCop commented Feb 24, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: c100b2f8b3aa6cb7ef4814edab286d525b0d7f97

  • Commits must be prefixed with the package(s) they modify

  • Commit: 46fd61e3619cf13848503ed124479bc2b856d4b5

  • Commits must be prefixed with the package(s) they modify

  • Commit: 82d421d7fdf4b5cc9c0e574c7b31339b03cc8ae6

  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@jmozah
Copy link
Contributor Author

jmozah commented Feb 24, 2017

  • Pulled recent changes
  • fixed this PR w.r.to new changes (glog to log)
  • added fuse in vendor

@jmozah
Copy link
Contributor Author

jmozah commented Feb 24, 2017

@zelig Need some fixes based on OS (compilation is failing in windows as Fuse is not supported in windows). Will fix that and rebase it.

@GitCop
Copy link

GitCop commented Feb 24, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 11c07d58723a2fa5cdf138959308607ac1334a7d
  • Your commit message body contains a line that is longer than 80 characters

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

1 similar comment
@GitCop
Copy link

GitCop commented Feb 24, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 11c07d58723a2fa5cdf138959308607ac1334a7d
  • Your commit message body contains a line that is longer than 80 characters

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Feb 24, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 7f2cea16205b6a8e152a862f888e52e67e2d4b05

  • Your commit message body contains a line that is longer than 80 characters

  • Commit: 3d30d8eafa298a85efd5d9709cb275c31d904aca

  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Feb 24, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 7f2cea16205b6a8e152a862f888e52e67e2d4b05
  • Your commit message body contains a line that is longer than 80 characters

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@jmozah jmozah closed this Feb 24, 2017
@jmozah jmozah reopened this Feb 24, 2017
}

const SWARMFS_JS = `
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the list is this file sorted alphabetically. Both the above and below too (swarm is notorious for adding stuff all over the place in this file :P)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure.. will do that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@GitCop
Copy link

GitCop commented Mar 1, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 3fc7e66fceec349e8c6f1ce978404387cdf02b28
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 1, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: a9b045ed6d00d714d93901c795a9f6b5e09d827a
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 1, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: cf8da3ac1fdca196c362b0941dc83f49dd9c70b0
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 2, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 5c0220ab969792f5710540dc98acb32b2f7fbd79
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 2, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: f5a25911db3bf885af8794eb2bed0b1c72fb7c1b
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 3, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 8679b232a617ce5eee547b7be566d40863de7b59
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 3, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 8679b232a617ce5eee547b7be566d40863de7b59

  • Commits must be prefixed with the package(s) they modify

  • Commit: c78c6ff932124d62aa129e85ddd1b47dea072911

  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 3, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 8679b232a617ce5eee547b7be566d40863de7b59

  • Commits must be prefixed with the package(s) they modify

  • Commit: c78c6ff932124d62aa129e85ddd1b47dea072911

  • Commits must be prefixed with the package(s) they modify

  • Commit: b2be8237ced4cfc8444fa03ac9eebbc12cb78911

  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 3, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 8679b232a617ce5eee547b7be566d40863de7b59

  • Commits must be prefixed with the package(s) they modify

  • Commit: c78c6ff932124d62aa129e85ddd1b47dea072911

  • Commits must be prefixed with the package(s) they modify

  • Commit: b2be8237ced4cfc8444fa03ac9eebbc12cb78911

  • Commits must be prefixed with the package(s) they modify

  • Commit: 4b9ab71114aa3755df76fbc20d9cd6d9a673451f

  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 3, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: b2fbd99e5ee0d8ff5d8ae2d64cd4c1f4f2ff69ad
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 3, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 94fee69d96c90a67659d75fde3c68e88bc8f722c
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 3, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 449151d8c038d6d8dc2ef30edd723a5bae9a6a74
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Mar 4, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 797a176ae633de9a72b2cad1930a72db1e0178e3
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

Copy link
Contributor

@zelig zelig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just very minor things.
Otherwise great stuff, thanks @jmozah

I need someone else to approve the travis and vendor stuff. I guess @karalabe might be willing




func (self *SwarmFS) Mount(mhash, mountpoint string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RPC supports (interface{}, err) composite return values. I think Mount and Unmount should use it, for proper RPC error responses

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah.. will fix this

@@ -216,7 +220,7 @@ func (self *Swarm) Stop() error {
if self.lstore != nil {
self.lstore.DbStore.Close()
}

self.sfs.Stop()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can something foul happen if we do not unmount active mounts. E.g. KILLSIG?
SIGINT and recently also SIGTERM are caught gracefully

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the device is busy.. we cannot unmount and this will return after 5 seconds without unmounting. We cannot do much here... the mount will be visible from "mount" command and it can be unmounted using external "umount" command ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can always unmount from the bash prompt "umount swarmfs"

swarm/swarm.go Outdated
Namespace: "swarmfs",
Version: api.Swarmfs_Version,
Service: api.NewSwarmFS(self.api),
Public: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well I think the idea was that we do not 'public' an API that can read/write the filesystem.
Not sure if there is rpcapis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aah.. ok.. i will change it to false...

@zelig
Copy link
Contributor

zelig commented Mar 6, 2017

also the travis issue with sudo? is that gonna be fixed? @karalabe
https://travis-ci.org/ethereum/go-ethereum/jobs/207629031#L295

@zelig zelig added this to the 1.6.0 milestone Mar 13, 2017
Copy link
Contributor

@fjl fjl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the (minor) issues. I still need to actually try it out but the code looks OK.

General feedback: The fuse stuff should probably be in its own package e.g. swarm/fusefs.

})
return swarmfs

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On any but the first call, NewSwarmFS returns the same SwarmFS regardless of api. IMHO that's confusing and might lead to bugs later. Why does it need to be a global singleton?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought about this... let me see if there is clean way to avoid having singleton logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried moving the fuse stuff inside a package.. but this right now depends on some methods which are not exposed as api... let me attempt this once more ..

@@ -0,0 +1,266 @@
// +build !windows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put build constraints below the license header.

// Copyright...

// +build !windows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aah okay.. will fix it

build/ci.go Outdated
packages = append(packages, strings.TrimSpace(line))
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it would be better to remove anything with github.com/ethereum/go-ethereum/vendor/ prefix, on all platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It cannot be removed for all platforms, as some fuse test are dependent on it.
It is removed for windows since windows does not support fuse or user level file system support in general.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not remove for all platforms since "vendor/basil.org/fuse" is required by other platforms for the test cases to work.
Fuse support is not there only in windows.. thats why i removed those for windows.

Copy link
Contributor

@fjl fjl Mar 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this change fixes make all and related commands by excluding "bazil.org/fuse" from the expansion of "./..." for the purpose of building and testing.

My suggestion is that all vendored packages should be excluded. Building vendored packages explicitly is almost never needed; testing them doesn't do anything because we strip their _test.go files when adding them. They will still be built as dependencies of non-vendored packages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gotta say that it sucks that bazil.org/fuse doesn't even build on Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aah... i didnt see this recent comment...
Are you saying that i remove compiling vendor packages for all platforms...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it.. i removed all vendors packages

@zelig
Copy link
Contributor

zelig commented Mar 16, 2017

@jmozah please consider @fjl's advice.

I am very happy with this PR

@fjl I tried it out and it works like a charm

@jmozah
Copy link
Contributor Author

jmozah commented Mar 22, 2017

@fjl @zelig Fixed the following comments

  • Moved the singleton logic out
  • Put build constraints below the license header

Thanks for reviewing and your comments

@fjl
Copy link
Contributor

fjl commented Mar 22, 2017

Minor notes about the commit message (you don't need to fix this, I'll edit it when squashing).

  • You don't need to include every package that was modified. It is sufficient to include the packages where the most of the new stuff is. In this case, that's probably "cmd/swarm, swarm/api".
  • The format is "pkg1, pkg2: foo", not "pkg1;pkg2 : foo".

@fjl
Copy link
Contributor

fjl commented Mar 22, 2017

And a question: are you planning to move fuse support to swarm/fusefs or not?

@jmozah
Copy link
Contributor Author

jmozah commented Mar 22, 2017

@fjl Not in this release... That will require some refactoring of the code in swarm/api and expose some methods which are not exposed for now.

@jmozah
Copy link
Contributor Author

jmozah commented Mar 22, 2017

@fjl I am doing more refactoring and adding more stuff in #3751.. will take it up as part of that if that is okay

@fjl
Copy link
Contributor

fjl commented Mar 22, 2017

Cool, thanks. I'm fine with keeping it in swarm/api for now.
.travis.yml has been updated on master. Sorry for the rebase trouble.
Please implement the vendor/ skipping as suggested. We're good to merge after that.

@jmozah
Copy link
Contributor Author

jmozah commented Mar 22, 2017

@fjl no issues.. i will resolve the conflict and rebase
Regarding vendor skipping my answer was that we cannot skip it for all platforms...
They are used in testcases for linux and darwin...
thats the reason i skipped only for windows...

@jmozah
Copy link
Contributor Author

jmozah commented Mar 22, 2017

@fjl fixed the vendor skipping..

@fjl fjl changed the title FUSE read-only support for swarm swarm/api: support mounting manifests via FUSE Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants